<?php
session_start();
require_once("../lib/DbWrapper.class.php");
require("../libs/Smarty.class.php");
require("../libs/myUtil.class.php");

$smarty =new Smarty;

//input.phpから来たかどうかを判断する処理
if($_SESSION["member_edit_confirm_id"] != $_POST["member_edit_confirm_id"]){
    header("Location:http://localhost/bbs/admin/index.php");
}else{
    //同じページでの更新を防ぐ処理
    $_SESSION["member_edit_confirm_id"] = rand();
}

$id = $_POST["id"];
$nickname =$_POST["nickname"];
$mailaddress =$_POST["mailaddress"];
$password =$_POST["password"];
$admin_yn = $_POST["admin_yn"];

DbWrapper::dbChoice();

//クエリを送信する
$sql = "UPDATE member SET nickname = \"".
        $nickname.
        "\", mailaddress = \"".
        $mailaddress.
        "\", password = \"".
        $password.
        "\", admin_yn =\"".
        $admin_yn.
        "\" WHERE id =".
        $id.
        "AND delete_yn != 'y'";

$result = mysql_query($sql);

print_r($_SESSION);
$smarty->display("member_edit_result.tpl");
?>